home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
10,000 Great Games
/
10,000 Great Games.iso
/
Product
/
66
/
data1.cab
/
Source_Files
/
Src
/
Bullet.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2000-01-16
|
796b
|
47 lines
#include "stdafx.h"
cBullet::cBullet(int _x, int _y, fix angle, cGameObject *_owner)
: cWeapon(_x, _y, bullet, "MOVING")
{
// Set speed
set_angular_speed(BULLET_SPEED, angle);
set_angular_acceleration(BULLET_ACC, angle);
// Set other
owner = _owner;
not_owner_timeout = 2 * sec;
invulnerable = TRUE;
made_trail = sec/10 + rnd(sec/4);
}
cBullet::~cBullet()
{
}
int cBullet::control()
{
cWeapon::control();
// Check if we were hit
if (explode)
return FALSE;
// Create trail
if (!low_detail_level && !made_trail)
{
new cEffect (x, y, orig, "TRAIL");
made_trail = sec/10 + rnd(sec/4);
}
// Check if we hit something or we go off screen
return !check_radial_hit_one(circle_bounds) && on_screen();
}